package com.ruoyi.bnt.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bnt.mapper.BntArticleinfoMapper;
import com.ruoyi.bnt.domain.BntArticleinfo;
import com.ruoyi.bnt.service.IBntArticleinfoService;
import com.ruoyi.common.core.text.Convert;

/**
 * 课程详情（文章）Service业务层处理
 * 
 * @author yyj
 * @date 2020-10-03
 */
@Service
public class BntArticleinfoServiceImpl implements IBntArticleinfoService 
{
    @Autowired
    private BntArticleinfoMapper bntArticleinfoMapper;

    /**
     * 查询课程详情（文章）
     * 
     * @param id 课程详情（文章）ID
     * @return 课程详情（文章）
     */
    @Override
    public BntArticleinfo selectBntArticleinfoById(String id)
    {
        return bntArticleinfoMapper.selectBntArticleinfoById(id);
    }

    /**
     * 查询课程详情（文章）列表
     * 
     * @param bntArticleinfo 课程详情（文章）
     * @return 课程详情（文章）
     */
    @Override
    public List<BntArticleinfo> selectBntArticleinfoList(BntArticleinfo bntArticleinfo)
    {
        return bntArticleinfoMapper.selectBntArticleinfoList(bntArticleinfo);
    }

    /**
     * 新增课程详情（文章）
     * 
     * @param bntArticleinfo 课程详情（文章）
     * @return 结果
     */
    @Override
    public int insertBntArticleinfo(BntArticleinfo bntArticleinfo)
    {
        bntArticleinfo.setCreateTime(DateUtils.getNowDate());
        return bntArticleinfoMapper.insertBntArticleinfo(bntArticleinfo);
    }

    /**
     * 修改课程详情（文章）
     * 
     * @param bntArticleinfo 课程详情（文章）
     * @return 结果
     */
    @Override
    public int updateBntArticleinfo(BntArticleinfo bntArticleinfo)
    {
        bntArticleinfo.setUpdateTime(DateUtils.getNowDate());
        return bntArticleinfoMapper.updateBntArticleinfo(bntArticleinfo);
    }

    /**
     * 删除课程详情（文章）对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBntArticleinfoByIds(String ids)
    {
        return bntArticleinfoMapper.deleteBntArticleinfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除课程详情（文章）信息
     * 
     * @param id 课程详情（文章）ID
     * @return 结果
     */
    @Override
    public int deleteBntArticleinfoById(String id)
    {
        return bntArticleinfoMapper.deleteBntArticleinfoById(id);
    }

    public int addVisitNum(String id){return bntArticleinfoMapper.addVisitNum(id);}
}
